<?php
/**
 * Created by PhpStorm.
 * User: 王文凡<787802868@qq.com>
 * Date: 2016/8/15 0015
 * Time: 11:21
 */

namespace Admin\Controller;

use Common\Controller\AuthController;
use Think\Controller;

class SystemSetController extends AuthController
{

    //基础设置
    public function foundation(){
        $vo=$this->configList();
        $vo['severurl']= 'http://'.$_SERVER['HTTP_HOST'].'/Api/'.$vo['token'];
        $this->assign('vo',$vo);
        $this->assign('title','系统设置');
        $this->display();
    }
    //公司配置
    public function companyConfig(){

        $vo=$this->configList();
        $this->assign('vo',$vo);
        $this->assign('title','公司信息设置');
        $this->display();
    }
    //银行卡信息
    public function bankConfig(){

        $vo=$this->configList();
        $this->assign('vo',$vo);
        $this->assign('title','银行卡信息设置');
        $this->display();
    }
    //其他信息
    public function restConfig(){
        $vo=$this->configList();
        $this->assign('vo',$vo);
        $this->assign('title','其他信息设置');
        $this->display();
    }
    //更新系统设置信息
    public function updateInfo(){
        if(IS_POST){
          $data=M('WechatConfig')->where("wid=%d",1)->save($_POST);
            if($data){
                $this->success('更新成功');
            }else{
                $this->error('更新失败');
            }
        }
    }

    //查询配置文件信息
    protected  function configList(){
        return M('WechatConfig')->where("wid=%d",1)->find();

    }
}














